




/*
'===============================================================================
'  MP.LayerHelper.MP_OBS.BL.MbLogPageDetailManagerBase
'===============================================================================
*/

using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using MP.LayerHelper.MP_OBS.BLL;
using MP.LayerHelper.MP_OBS.DAL;
using MP.LayerHelper.MP_OBS.DAL.EntityClasses;
using MP.LayerHelper.MP_OBS.DAL.FactoryClasses;
using MP.LayerHelper.MP_OBS.DAL.HelperClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;

namespace MP.LayerHelper.MP_OBS.BLL
{
	public class MbLogPageDetailManagerBase : ManagerBase
	{
		/// <summary>
		/// Purpose: Class constructor.
		/// </summary>
		
		public MbLogPageDetailManagerBase()
		{
			// Nothing for now.
		}
		
		public override string TableName()
        {
            return "MbLogPageDetail";
        }
		
		public MbLogPageDetailEntity Insert(MbLogPageDetailEntity _MbLogPageDetailEntity)
		{
			return Insert(_MbLogPageDetailEntity, "");
		}
		
		public MbLogPageDetailEntity Insert(MbLogPageDetailEntity _MbLogPageDetailEntity, string controlId)
		{
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.SaveEntity(_MbLogPageDetailEntity, true);
				MbLogPageDetailFields field = new MbLogPageDetailFields();
                LogEntity(_MbLogPageDetailEntity, field, AcInsert, controlId);
			}
			return _MbLogPageDetailEntity;
		}

		
		public MbLogPageDetailEntity Insert(Guid Id, Guid LogPageId, DateTime LogDate, string ClientIp, string QueryParam, Guid BranchId)
		{
			MbLogPageDetailEntity _MbLogPageDetailEntity = new MbLogPageDetailEntity();
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				
				_MbLogPageDetailEntity.Id = Id;
				_MbLogPageDetailEntity.LogPageId = LogPageId;
				_MbLogPageDetailEntity.LogDate = LogDate;
				_MbLogPageDetailEntity.ClientIp = ClientIp;
				_MbLogPageDetailEntity.QueryParam = QueryParam;
				_MbLogPageDetailEntity.BranchId = BranchId;
				MbLogPageDetailFields field = new MbLogPageDetailFields();
                LogEntity(_MbLogPageDetailEntity, field, AcInsert);
				adapter.SaveEntity(_MbLogPageDetailEntity, true);
			}
			return _MbLogPageDetailEntity;
		}

		public MbLogPageDetailEntity Insert(Guid LogPageId, DateTime LogDate, string ClientIp, string QueryParam, Guid BranchId)
		{
			MbLogPageDetailEntity _MbLogPageDetailEntity = new MbLogPageDetailEntity();
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				
				_MbLogPageDetailEntity.LogPageId = LogPageId;
				_MbLogPageDetailEntity.LogDate = LogDate;
				_MbLogPageDetailEntity.ClientIp = ClientIp;
				_MbLogPageDetailEntity.QueryParam = QueryParam;
				_MbLogPageDetailEntity.BranchId = BranchId;
				adapter.SaveEntity(_MbLogPageDetailEntity, true);
				MbLogPageDetailFields field = new MbLogPageDetailFields();
                LogEntity(_MbLogPageDetailEntity, field, AcInsert);
			}
			return _MbLogPageDetailEntity;
		}
		
		public bool Update(MbLogPageDetailEntity _MbLogPageDetailEntity)
        {
            return Update(_MbLogPageDetailEntity, "");
        }

		public bool Update(MbLogPageDetailEntity _MbLogPageDetailEntity, string controlId)
		{
			bool toReturn = false;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				RelationPredicateBucket filter = new RelationPredicateBucket();
				IPredicateExpression _PredicateExpression = new PredicateExpression();
				_PredicateExpression.Add(MbLogPageDetailFields.Id == _MbLogPageDetailEntity.Id);
					
				filter.PredicateExpression.Add(_PredicateExpression);

				adapter.UpdateEntitiesDirectly(_MbLogPageDetailEntity, filter);
				toReturn = true;
				
				MbLogPageDetailFields field = new MbLogPageDetailFields();
                LogEntity(_MbLogPageDetailEntity, field, AcUpdate, controlId);
			}
			return toReturn;
		}
		
		public bool Update(MbLogPageDetailEntity _MbLogPageDetailEntity, RelationPredicateBucket filter)
		{
			bool toReturn = false;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.UpdateEntitiesDirectly(_MbLogPageDetailEntity, filter);
				toReturn = true;
				
				MbLogPageDetailFields field = new MbLogPageDetailFields();
                LogEntity(_MbLogPageDetailEntity, field, AcUpdate);
			}
			return toReturn;
		}

		public bool Update(Guid Id, Guid LogPageId, DateTime LogDate, string ClientIp, string QueryParam, Guid BranchId)
		{
			bool toReturn = false;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				MbLogPageDetailEntity _MbLogPageDetailEntity = new MbLogPageDetailEntity(Id);
				if (adapter.FetchEntity(_MbLogPageDetailEntity))
				{
				
					_MbLogPageDetailEntity.LogPageId = LogPageId;
					_MbLogPageDetailEntity.LogDate = LogDate;
					_MbLogPageDetailEntity.ClientIp = ClientIp;
					_MbLogPageDetailEntity.QueryParam = QueryParam;
					_MbLogPageDetailEntity.BranchId = BranchId;
					adapter.SaveEntity(_MbLogPageDetailEntity, true);
					toReturn = true;
					
					MbLogPageDetailFields field = new MbLogPageDetailFields();
					LogEntity(_MbLogPageDetailEntity, field, AcUpdate);
				}
			}
			return toReturn;
		}

		public bool Delete(Guid Id)
		{
			bool toReturn = false;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				MbLogPageDetailEntity _MbLogPageDetailEntity = new MbLogPageDetailEntity(Id);
				if (adapter.FetchEntity(_MbLogPageDetailEntity))
				{
					adapter.DeleteEntity(_MbLogPageDetailEntity);
					toReturn = true;
				}
			}
			return toReturn;
		}
		
		public void DeleteAll() 
		{
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.DeleteEntitiesDirectly("MbLogPageDetailEntity", null);
			}
		}
		
		
		public int DeleteById(Guid Id)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbLogPageDetailFields.Id == Id);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("MbLogPageDetailEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByLogPageId(Guid LogPageId)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbLogPageDetailFields.LogPageId == LogPageId);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("MbLogPageDetailEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByLogDate(DateTime LogDate)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbLogPageDetailFields.LogDate == LogDate);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("MbLogPageDetailEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByClientIp(string ClientIp)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbLogPageDetailFields.ClientIp == ClientIp);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("MbLogPageDetailEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByQueryParam(string QueryParam)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbLogPageDetailFields.QueryParam == QueryParam);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("MbLogPageDetailEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByBranchId(Guid BranchId)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbLogPageDetailFields.BranchId == BranchId);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("MbLogPageDetailEntity", filter);
			}
			return toReturn;
		}
		

		
		public MbLogPageDetailEntity SelectOne(Guid Id)
		{
			MbLogPageDetailEntity toReturn = null;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				MbLogPageDetailEntity _MbLogPageDetailEntity = new MbLogPageDetailEntity(Id);
				if (adapter.FetchEntity(_MbLogPageDetailEntity))
				{
					toReturn = _MbLogPageDetailEntity;
				}
			}
			return toReturn;
		}

		// Return DataTable
		public DataTable SelectAllRDT()
		{
			DataTable toReturn = new DataTable();
			EntityCollection _MbLogPageDetailCollection = new EntityCollection(new MbLogPageDetailEntityFactory());
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_MbLogPageDetailCollection.EntityFactoryToUse.CreateFields(), toReturn, null, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection<MbLogPageDetailEntity>
		public EntityCollection<MbLogPageDetailEntity> SelectAllLST()
		{
			EntityCollection<MbLogPageDetailEntity> _MbLogPageDetailCollection = new EntityCollection<MbLogPageDetailEntity>();
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_MbLogPageDetailCollection, null, 0, null);
			}
			return _MbLogPageDetailCollection;
		}
		
		// Return EntityCollection<MbLogPageDetailEntity>
		public EntityCollection<MbLogPageDetailEntity> SelectAllLST_Paged(int PageNumber, int PageSize)
		{
			EntityCollection<MbLogPageDetailEntity> _MbLogPageDetailCollection = new EntityCollection<MbLogPageDetailEntity>();
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_MbLogPageDetailCollection, null, 0, null, null, PageNumber, PageSize);
			}
			return _MbLogPageDetailCollection;
		}


		
		// Return EntityCollection<MbLogPageDetailEntity>
		public EntityCollection<MbLogPageDetailEntity> SelectByIdLST(Guid Id)
		{
			EntityCollection<MbLogPageDetailEntity> _MbLogPageDetailCollection = new EntityCollection<MbLogPageDetailEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbLogPageDetailFields.Id == Id);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_MbLogPageDetailCollection, filter, 0, null);
			}
			return _MbLogPageDetailCollection;
		}
		
		// Return EntityCollection<MbLogPageDetailEntity>
		public EntityCollection<MbLogPageDetailEntity> SelectByIdLST_Paged(Guid Id, int PageNumber, int PageSize)
		{
			EntityCollection<MbLogPageDetailEntity> _MbLogPageDetailCollection = new EntityCollection<MbLogPageDetailEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbLogPageDetailFields.Id == Id);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_MbLogPageDetailCollection, filter, 0, null, null, PageNumber, PageSize);
			}
			return _MbLogPageDetailCollection;
		}
		
		// Return DataTable
		public DataTable SelectByIdRDT(Guid Id)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _MbLogPageDetailCollection = new EntityCollection(new MbLogPageDetailEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbLogPageDetailFields.Id == Id);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_MbLogPageDetailCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return DataTable
		public DataTable SelectByIdRDT_Paged(Guid Id, int PageNumber, int PageSize)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _MbLogPageDetailCollection = new EntityCollection(new MbLogPageDetailEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbLogPageDetailFields.Id == Id);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_MbLogPageDetailCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, 0, null, true, null, PageNumber, PageSize);
			}
			return toReturn;
		}


		
		// Return EntityCollection<MbLogPageDetailEntity>
		public EntityCollection<MbLogPageDetailEntity> SelectByLogPageIdLST(Guid LogPageId)
		{
			EntityCollection<MbLogPageDetailEntity> _MbLogPageDetailCollection = new EntityCollection<MbLogPageDetailEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbLogPageDetailFields.LogPageId == LogPageId);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_MbLogPageDetailCollection, filter, 0, null);
			}
			return _MbLogPageDetailCollection;
		}
		
		// Return EntityCollection<MbLogPageDetailEntity>
		public EntityCollection<MbLogPageDetailEntity> SelectByLogPageIdLST_Paged(Guid LogPageId, int PageNumber, int PageSize)
		{
			EntityCollection<MbLogPageDetailEntity> _MbLogPageDetailCollection = new EntityCollection<MbLogPageDetailEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbLogPageDetailFields.LogPageId == LogPageId);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_MbLogPageDetailCollection, filter, 0, null, null, PageNumber, PageSize);
			}
			return _MbLogPageDetailCollection;
		}
		
		// Return DataTable
		public DataTable SelectByLogPageIdRDT(Guid LogPageId)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _MbLogPageDetailCollection = new EntityCollection(new MbLogPageDetailEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbLogPageDetailFields.LogPageId == LogPageId);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_MbLogPageDetailCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return DataTable
		public DataTable SelectByLogPageIdRDT_Paged(Guid LogPageId, int PageNumber, int PageSize)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _MbLogPageDetailCollection = new EntityCollection(new MbLogPageDetailEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbLogPageDetailFields.LogPageId == LogPageId);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_MbLogPageDetailCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, 0, null, true, null, PageNumber, PageSize);
			}
			return toReturn;
		}


		
		// Return EntityCollection<MbLogPageDetailEntity>
		public EntityCollection<MbLogPageDetailEntity> SelectByLogDateLST(DateTime LogDate)
		{
			EntityCollection<MbLogPageDetailEntity> _MbLogPageDetailCollection = new EntityCollection<MbLogPageDetailEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbLogPageDetailFields.LogDate == LogDate);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_MbLogPageDetailCollection, filter, 0, null);
			}
			return _MbLogPageDetailCollection;
		}
		
		// Return EntityCollection<MbLogPageDetailEntity>
		public EntityCollection<MbLogPageDetailEntity> SelectByLogDateLST_Paged(DateTime LogDate, int PageNumber, int PageSize)
		{
			EntityCollection<MbLogPageDetailEntity> _MbLogPageDetailCollection = new EntityCollection<MbLogPageDetailEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbLogPageDetailFields.LogDate == LogDate);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_MbLogPageDetailCollection, filter, 0, null, null, PageNumber, PageSize);
			}
			return _MbLogPageDetailCollection;
		}
		
		// Return DataTable
		public DataTable SelectByLogDateRDT(DateTime LogDate)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _MbLogPageDetailCollection = new EntityCollection(new MbLogPageDetailEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbLogPageDetailFields.LogDate == LogDate);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_MbLogPageDetailCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return DataTable
		public DataTable SelectByLogDateRDT_Paged(DateTime LogDate, int PageNumber, int PageSize)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _MbLogPageDetailCollection = new EntityCollection(new MbLogPageDetailEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbLogPageDetailFields.LogDate == LogDate);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_MbLogPageDetailCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, 0, null, true, null, PageNumber, PageSize);
			}
			return toReturn;
		}


		
		// Return EntityCollection<MbLogPageDetailEntity>
		public EntityCollection<MbLogPageDetailEntity> SelectByClientIpLST(string ClientIp)
		{
			EntityCollection<MbLogPageDetailEntity> _MbLogPageDetailCollection = new EntityCollection<MbLogPageDetailEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbLogPageDetailFields.ClientIp == ClientIp);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_MbLogPageDetailCollection, filter, 0, null);
			}
			return _MbLogPageDetailCollection;
		}
		
		// Return EntityCollection<MbLogPageDetailEntity>
		public EntityCollection<MbLogPageDetailEntity> SelectByClientIpLST_Paged(string ClientIp, int PageNumber, int PageSize)
		{
			EntityCollection<MbLogPageDetailEntity> _MbLogPageDetailCollection = new EntityCollection<MbLogPageDetailEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbLogPageDetailFields.ClientIp == ClientIp);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_MbLogPageDetailCollection, filter, 0, null, null, PageNumber, PageSize);
			}
			return _MbLogPageDetailCollection;
		}
		
		// Return DataTable
		public DataTable SelectByClientIpRDT(string ClientIp)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _MbLogPageDetailCollection = new EntityCollection(new MbLogPageDetailEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbLogPageDetailFields.ClientIp == ClientIp);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_MbLogPageDetailCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return DataTable
		public DataTable SelectByClientIpRDT_Paged(string ClientIp, int PageNumber, int PageSize)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _MbLogPageDetailCollection = new EntityCollection(new MbLogPageDetailEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbLogPageDetailFields.ClientIp == ClientIp);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_MbLogPageDetailCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, 0, null, true, null, PageNumber, PageSize);
			}
			return toReturn;
		}


		
		// Return EntityCollection<MbLogPageDetailEntity>
		public EntityCollection<MbLogPageDetailEntity> SelectByQueryParamLST(string QueryParam)
		{
			EntityCollection<MbLogPageDetailEntity> _MbLogPageDetailCollection = new EntityCollection<MbLogPageDetailEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbLogPageDetailFields.QueryParam == QueryParam);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_MbLogPageDetailCollection, filter, 0, null);
			}
			return _MbLogPageDetailCollection;
		}
		
		// Return EntityCollection<MbLogPageDetailEntity>
		public EntityCollection<MbLogPageDetailEntity> SelectByQueryParamLST_Paged(string QueryParam, int PageNumber, int PageSize)
		{
			EntityCollection<MbLogPageDetailEntity> _MbLogPageDetailCollection = new EntityCollection<MbLogPageDetailEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbLogPageDetailFields.QueryParam == QueryParam);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_MbLogPageDetailCollection, filter, 0, null, null, PageNumber, PageSize);
			}
			return _MbLogPageDetailCollection;
		}
		
		// Return DataTable
		public DataTable SelectByQueryParamRDT(string QueryParam)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _MbLogPageDetailCollection = new EntityCollection(new MbLogPageDetailEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbLogPageDetailFields.QueryParam == QueryParam);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_MbLogPageDetailCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return DataTable
		public DataTable SelectByQueryParamRDT_Paged(string QueryParam, int PageNumber, int PageSize)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _MbLogPageDetailCollection = new EntityCollection(new MbLogPageDetailEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbLogPageDetailFields.QueryParam == QueryParam);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_MbLogPageDetailCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, 0, null, true, null, PageNumber, PageSize);
			}
			return toReturn;
		}


		
		// Return EntityCollection<MbLogPageDetailEntity>
		public EntityCollection<MbLogPageDetailEntity> SelectByBranchIdLST(Guid BranchId)
		{
			EntityCollection<MbLogPageDetailEntity> _MbLogPageDetailCollection = new EntityCollection<MbLogPageDetailEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbLogPageDetailFields.BranchId == BranchId);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_MbLogPageDetailCollection, filter, 0, null);
			}
			return _MbLogPageDetailCollection;
		}
		
		// Return EntityCollection<MbLogPageDetailEntity>
		public EntityCollection<MbLogPageDetailEntity> SelectByBranchIdLST_Paged(Guid BranchId, int PageNumber, int PageSize)
		{
			EntityCollection<MbLogPageDetailEntity> _MbLogPageDetailCollection = new EntityCollection<MbLogPageDetailEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbLogPageDetailFields.BranchId == BranchId);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_MbLogPageDetailCollection, filter, 0, null, null, PageNumber, PageSize);
			}
			return _MbLogPageDetailCollection;
		}
		
		// Return DataTable
		public DataTable SelectByBranchIdRDT(Guid BranchId)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _MbLogPageDetailCollection = new EntityCollection(new MbLogPageDetailEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbLogPageDetailFields.BranchId == BranchId);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_MbLogPageDetailCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return DataTable
		public DataTable SelectByBranchIdRDT_Paged(Guid BranchId, int PageNumber, int PageSize)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _MbLogPageDetailCollection = new EntityCollection(new MbLogPageDetailEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbLogPageDetailFields.BranchId == BranchId);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_MbLogPageDetailCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, 0, null, true, null, PageNumber, PageSize);
			}
			return toReturn;
		}


		
		

	}
}
